/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package br.com.geftu.HibernateUtil;

import javax.swing.JOptionPane;
import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.hibernate.cfg.Configuration;

/**
 *
 * @author jorgenei
 */
public class HibernateUtil
{
    private static SessionFactory fabricadesessoes;
    static
    {
        try
        {
            fabricadesessoes = new Configuration().configure().buildSessionFactory();            
        }
        catch(Exception erro)
        {
            JOptionPane.showMessageDialog(null," Erro na fabrica de sessoes = "+erro);
            fabricadesessoes = null;
        }
    }

        public static Session getSession()
            {
                return fabricadesessoes.openSession();
            }

    
}
